<template>
	<view>
		{{ user.nickname }}
		<navigator url="./login/login">登录</navigator>
		<navigator url="./car/car">购物车</navigator>
		<navigator url="./order/index/index">订单</navigator>
		<button type="default" @tap="upload">
			头像上传
		</button>
	</view>
</template>

<script>
	import baseUrl from "@/api/baseUrl.js"
	export default {
		data() {
			return {
				user:{}
			};
		},
		methods:{
			upload(){
				// 1. 从本地选取图片
				uni.chooseImage({
					count:1,
					success(res){
						
						// 2 .上传资源
						uni.uploadFile({
							url:baseUrl + "/lejuClient/login/uploadAvatar",
							filePath:res.tempFilePaths[0],
							name:"file",
							success(res1){
								console.log(res1);
							}
						})
					}
				})
			}
		},
		onLoad() {
			var user = uni.getStorageSync("userInfo");
			this.user = user
		}
	}
</script>

<style lang="scss" scoped>

</style>
